package cevent.source.cloudcenter.system.controller.nacos;/**
 * Created by Cevent on 2021/8/12.
 */

import cevent.source.cloudcenter.server.dto.ResponseDataDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cevent
 * @description nacos测试controller
 * @date 2021/8/12 11:44
 */
//实时读取nacos的配置项@RefreshScope,新版本失效
@RefreshScope
@RestController
@RequestMapping("/nacos")
public class NacosTestController {
    private static final Logger LOG= LoggerFactory.getLogger(NacosTestController.class);
    public static final String BUSINESS_NAME="Nacos配置中心测试controller";

    @Value("${system.test}")
    private String systemTest;

    @RefreshScope
    @GetMapping("/getTest")
    public ResponseDataDto getTest(){
        ResponseDataDto responseData=new ResponseDataDto();

        responseData.setResponseData(systemTest);
        return responseData;
    }
}
